package cn.admobiletop.adsuyi.adapter.toutiao.data;

import android.app.Activity;
import android.os.Handler;
import android.os.Looper;
import android.view.View;

import com.bytedance.sdk.openadsdk.TTNativeExpressAd;

import org.json.JSONObject;

import java.lang.reflect.Field;
import java.util.List;

import cn.admobiletop.adsuyi.ad.listener.ADSuyiBannerAdListener;
import cn.admobiletop.adsuyi.ad.material.ADSuyiMaterialRawInfoAd;

/**
 * @author ciba
 * @description Banner广告内容对象
 * @date 2020/4/3
 */
public class BannerAdInfo extends TTNativeExpressAdInfo<ADSuyiBannerAdListener> {
    private Handler handler = new Handler(Looper.getMainLooper());

    public BannerAdInfo(Activity activity, String platformPosId) {
        super(activity, platformPosId);
    }

    @Override
    public void onCloseClick(View view) {
        if (handler != null) {
            handler.post(new Runnable() {
                @Override
                public void run() {
                    if (getAdListener() != null) {
                        getAdListener().onAdClose(BannerAdInfo.this);
                    }
                }
            });
        }
    }

    @Override
    public void releaseAdapter() {
        super.releaseAdapter();
        if (handler != null) {
            handler.removeCallbacksAndMessages(null);
            handler = null;
        }
    }
}
